<script type="text/javascript">
$(function() {
    var controller ='{$orderextm.shipping_name}' ? false : true;
    $('#cancel_button').click(function() {
        DialogManager.close('seller_order_shipped');
    });

    $('#their').bind('click', function() {
        $('#warning').empty().hide();
        if ($(this).attr('checked')) {
            controller = false;
            $('#J_shipped_wrap').hide();
        } else {
            controller = true;
            $('#J_shipped_wrap').show();
        }
    });

    $.validator.addMethod("check_type", function(value, element) {
        var go=true;
        if(controller){
            if(element.name === 'express'){
                if($('input[name="express"]:checked').length<1){
                    go=false;
                }
            }else{
                if (value.length < 1) {
                    go = false;
                }
            }
        }
        return go;
    });

    $('#seller_order_shipped').validate({
        errorLabelContainer: $('#warning'),
        rules: {
            invoice_no: {
                check_type: true
            },
            express: {
                check_type: true
            }
        },
        messages: {
            invoice_no: {
                check_type: '{$lang.invoice_no_empty}'
            },
            express: {
                check_type: '请选择物流公司'
            }
        }
    });

});
</script>
<ul class="tab">
    <li class="active">
        {$lang.shipped_order}
        <!--{if $order_returns.returns_case gt 1}--> <font style="color:#000;">({$order_returns.message})</font>
        <!--{/if}--> 
     </li>
</ul>
<div class="content1">
    <div id="warning"></div>
    <form method="post" action="index.php?app=seller_order&amp;act=shipped&amp;order_id={$order.order_id}&ajax" target="seller_order" id="seller_order_shipped">
        <!-- <h1>{$lang.input_invoice_no}</h1> -->
        <p>
            {$lang.order_sn} :
            <span>{$order.order_sn}</span>
        </p>
        <p style="background: #f1f1f1;margin-right: 65px;padding:5px 0 5px 10px;font-size: 18px;">
            <input type="checkbox" name="their" {if $orderextm.shipping_name eq '自提'}checked{/if} value="自提" id="their" />
            <label for="their">自提</label>
        </p>
        <div {if $orderextm.shipping_name eq '自提'}style="display: none;"{/if} id="J_shipped_wrap">
            <dl>
                <dt>物流公司：</dt>
                <dd>
                    <ul class="seller-order-shipped f-cb">
                        <!--{foreach from=$cfg_shipping_kuaidi name=kuaidi key=key item=kuaidi}-->
                        <li>
                            <input type="radio" name="express" class="express" id="express_type{$smarty.foreach.kuaidi.index}" value="{$key}" {if $orderextm.shipping_name eq $key}checked{/if} />
                            <label for="express_type{$smarty.foreach.kuaidi.index}">{$key}</label>
                        </li>
                        <!--{/foreach}--> </ul>
                </dd>
            </dl>
            <dl>
                <dt>{$lang.invoice_no}:</dt>
                <dd>
                    <input type="text" class="text" name="invoice_no" id="invoice_no_input" style="width:195px;" <!--{if $orderextm.shipping_name neq '自提'}-->
                    value="{$order.invoice_no}"
                    <!--{/if}-->class="search250" /></dd>
            </dl>
        </div>
        <div class="btn">
            <!--{if $order_returns.returns_case neq 3}-->
            <input type="submit" name="submit" id="confirm_button" class="btn1" value="{$lang.confirm}" />
            <!--{/if}-->
            <input type="button" name="reset" id="cancel_button" class="btn2" value="{$lang.cancel}" />
        </div>
    </form>
</div>